home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 17
/
AMIGAplus Sonderheft 17 (1999)(ICP)(DE)[!].iso
/
PD
/
Anwendungen
/
IxGuide
/
docs
/
ixclient_3.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-03-22
|
4KB
|
202 lines
/* Sample arexx client program for iX-Guide */
/* How to make scrolling object which takes */
/* care of changing documents, screens ... */
/* NOTE: never write programs which perform */
/* some graphics operations for a long period */
/* of time without using delay() */
if ~show('l', "rexxsupport.library") then
addlib('rexxsupport.library',0,-30,0)
OPTIONS RESULTS
/*
** Every rexx client receives pointer to iXG window as the last argument
** in form 'iXW=<address>'. That is the window the rexx client was launched
** from. You always have to pass this pointer to ADDCLIENT !
*/
PARSE ARG 'iXW=' windowPTR .
/*
** Port name of every rexx client should be in the following form:
** "IXCL_anythingyouwant_windowPTR"
*/
portname = "IXCL_demoCL3_"
portname = INSERT(windowPTR,portname,LENGTH(portname))
/************************************************************************/
if show('p',portname) then exit /* we are already running */
ADDRESS IXGUIDE
/*
** Add this client to iX-Guide and pass received window pointer
*/
AddClient windowPTR
/************************************************************************/
txt.1 = '" Scrolling text "'
txt.2 = '" -------------------- "'
txt.3 = '"This is demo of Arexx "'
txt.4 = '" controled object. "'
txt.5 = '" To stop scrolling "'
txt.6 = '" press STOP button "'
txt.7 = '" and START button to "'
txt.8 = '" start again "'
txt.9 = '" -------------------- "'
call openport(portname)
setport portname MISC
AllocRaster 2
rp=result
refresh rp
SetABPen rp 1 0
OpenFont 'times.font' 18; f1 = result
OpenFont 'topaz.font' 8; f2 = result
SetDrMd rp 0
shutdown=0
flag=0
stopscroll=0
contscroll=0
ypos = 120
linecnt = 1
do until shutdown
call waitpkt(portname)
msg = getpkt(portname)
if msg ~= '0000 0000'x then do
class = getarg(msg)
if class='0000 0000'x then shutdown=1 /* pointer to window is NULL */
else if class=windowPTR then do /* this is message from our window */
class = getarg(msg,1)
if class = 'MISC' then do
a1 = getarg(msg,2)
if a1 = 'QUIT' then shutdown=1
if a1 = 'CLOSEWIN' then shutdown=1
if a1 = 'LINKREQ' then do
a2 = getarg(msg,3)
if a2 = 'rx_start' then do
flag=1 /* we should start scrolling */
stopscroll=0
end
end /*end if LINKREQ*/
if (a1 = 'LINKOK') | (a1 = 'LINKFAILED') then
if contscroll then do
a2 = getarg(msg,3)
a3 = getarg(msg,4)
if (a2='iX-Guide.ixml') & (a3='arexx_demo') then do
flag=1
stopscroll=0
contscroll=0
end
end
if (a1 = 'OLDSCREEN') | (a1 = 'NEWSCREEN') then shutdown=1
/*if contscroll then do
flag=1
stopscroll=0
contscroll=0
end*/
end /*end if class==MISC*/
end
call reply(msg,0)
end /*end if msg*/
if flag=1 then do /* should we start scrolling? */
do until stopscroll
call scroll()
call delay(1)
call checkinput()
end /*end until stopscroll*/
flag=0
end /*end if flag==1*/
end /*end until shutdown*/
/* clean up */
CloseFont f1; CloseFont f2
FreeRaster rp
RemClient
call closeport(portname)
exit
checkinput:
cimsg = getpkt(portname)
do while cimsg ~= '0000 0000'x
ciclass = getarg(cimsg)
if ciclass='0000 0000'x then shutdown=1 /* pointer to window is NULL */
else if ciclass=windowPTR then do /* this is message from our window */
ciclass = getarg(msg,1)
if ciclass = 'MISC' then do
cia1 = getarg(cimsg,2)
if cia1 = 'QUIT' then do
stopscroll=1
shutdown=1
end
if cia1 = 'CLOSEWIN' then do
stopscroll=1
shutdown=1
end
if cia1 = 'LINKREQ' then do
stopscroll=1
cia2 = getarg(cimsg,3)
if cia2 ~= 'rx_stop' then contscroll=1
call reply(cimsg,0)
return 0
end
if cia1 = 'ASKSCREEN' then do
stopscroll=1
contscroll=1
call reply(cimsg,0)
return 0
end
end /*end if 'MISC'*/
end
call reply(cimsg,0)
cimsg = getpkt(portname)
end /*end do while cimsg*/
return 0
scroll:
ypos = ypos - 1
if ypos<110 then do
ypos = 120
linecnt=linecnt+1
if linecnt>9 then linecnt=1
end
ScrollRaster rp 0 1 0 0 197 178
if linecnt=1 then SetABPen rp 2
else SetABPen rp 1
if linecnt=1 then do
SetFont rp f1
Move rp 30 ypos+2
Text rp txt.linecnt
end
else do
SetFont rp f2
Move rp 10 ypos
Text rp txt.linecnt
end
return 0